package com.code;

/**
 * Created by lucky on 2018/10/10.
 */
public class Code8 {
    public static void main(String[] args) {
        int[] v = new int[]{1,2,2};
        int i = singleNumber(v);
        System.out.println(i);
        System.out.println(1^2);
    }

    public static int singleNumber(int[] nums) {
        int len = nums.length;
        int result=0;
        for(int i=0;i<len;i++){
            result ^=nums[i];
        }
        return result;
    }
}
